<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
<h:body>
    <ui:composition template="template.xhtml">
        <ui:define name="content">
            <h:form>
                <h:panelGrid columns="2" columnClasses="top,top">
                    <rich:fileUpload fileUploadListener="#{profilePictureBean.listener}" id="upload" acceptedTypes="jpg, gif, png, bmp" ontyperejected="alert('#{msg.profilepicupload_unsupported_filetype}');" maxFilesQuantity="1">
                        <a4j:ajax event="uploadcomplete" execute="@none" render="info" />
                    </rich:fileUpload>
                    <h:panelGroup id="info" layout="block">
                        <rich:panel bodyClass="info">
                            <f:facet name="header">
                                <h:outputText value="Uploaded Files Info" />
                            </f:facet>
                            <h:outputText value="No files currently uploaded" rendered="#{profilePictureBean.imageFile == null}" />
                            <rich:panel bodyClass="rich-laguna-panel-no-header" rendered="#{profilePictureBean.imageFile != null}">
                                <h:panelGrid columns="2">
                                    <h:outputText value="File Name:" />
                                    <h:outputText value="#{profilePictureBean.imageFile.name}" />
                                    <h:outputText value="File Length(bytes):" />
                                    <h:outputText value="#{profilePictureBean.imageFile.length}" />
                                </h:panelGrid>
                            </rich:panel>
                        </rich:panel>
                        <br />
                        <a4j:commandButton action="#{profilePictureBean.clearUploadData}" render="info, upload" value="Clear Uploaded Data" rendered="#{profilePictureBean.imageFile != null}" />
                    </h:panelGroup>
                </h:panelGrid>
            </h:form>

        </ui:define>
    </ui:composition>
</h:body>
</html>

